<template>
    <div style="padding: 20px"  class="e-form">
        <el-form
            :model="auditParams"
            :rules="rulesBase"
            ref="rulesBase"
            class="demo-ruleForm"
            label-width="100px"
        >
            <el-row>
                <el-col :span="24">
                   <el-form-item label="审核结果" prop="isPass">
                        <el-radio v-model="auditParams.isPass" :label="true">同意</el-radio>
                        <el-radio v-model="auditParams.isPass" :label="false">返回修改</el-radio>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="24">
                    <el-form-item label="审核意见" prop="opinion">
                        <el-input
                            type="textarea"
                            :rows="4"
                            placeholder="请输入内容"
                            v-model="auditParams.opinion"
                        >
                        </el-input>
                    </el-form-item>
                </el-col>
            </el-row>
        </el-form>
    </div>
</template>

<script>
import { mapMutations, mapState } from 'vuex'

export default {
    data () {
        return {
            auditParams: {
                isPass: '',
                opinion: ''
            },
            rulesBase: {
                isPass: [
                    { required: true, message: '请选择审核结果', trigger: 'blur' },
                ],
                opinion: [
                    { required: true, message: '请输入审核意见', trigger: 'blur' },
                ],
            },
        }
    },
    computed: {
        ...mapState({ _auditParams: 'auditParams' })
    },
    watch: {
        auditParams: {
            handler (val) {
                console.log(val)
                this.setAuditParams(val)
            },
            deep: true
        }
    },
    created () {
        for(let  key in this._auditParams) {
            this.auditParams[key] = this._auditParams[key]
        }

    },
    methods: {
        ...mapMutations(['setAuditParams'])
    }
}
</script>

<style lang="sass" scoped></style>
